package com.youhong.teethcare.decorators;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;

import com.prolificinteractive.materialcalendarview.CalendarDay;
import com.prolificinteractive.materialcalendarview.DayViewDecorator;
import com.prolificinteractive.materialcalendarview.DayViewFacade;
import com.youhong.teethcare.R;

import java.util.Calendar;

/**
 * Use a custom selector
 */
public class MySelectorDecorator implements DayViewDecorator {

    private final Drawable drawable;
    Calendar c_selected;

    public MySelectorDecorator(Context context, Calendar calendar) {
        drawable = context.getResources().getDrawable(R.mipmap.ic_my_selector);
        c_selected = calendar;
    }

    @Override
    public boolean shouldDecorate(CalendarDay day) {

        if (day.getYear() == c_selected.get(Calendar.YEAR)
                && day.getMonth() == c_selected.get(Calendar.MONTH)
                && day.getDay() == c_selected.get(Calendar.DAY_OF_MONTH)
                ) {

            return true;

        }
        return false;
    }

    @Override
    public void decorate(DayViewFacade view) {
        view.setSelectionDrawable(drawable);

    }
}
